<?php
 if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Setting extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->data['controller'] = 'setting';   
        $this->load->model('Msetting');
        
        $this->checkAdmin($this->session->userdata('admin_id'), $this->session->userdata('permission_verify'));
        //$this->_per = $this->checkPerMission($this->session->userdata('admin'), $this->session->userdata('SessionPermisson'), 8, $this->session->userdata('admin_id'));
    }
    
    public function settinglimit()
    {
        /*if($this->_per->add != 2)
        {
            $this->redirect_notification($this->data['page'],array('Thông Báo', '<center><strong>Bạn không có quyền này</strong></center>'),'thong-bao', 'index');
            exit();
        }*/
        
        $this->data['data'] = $this->Msetting->getLimitUserCC();
        $this->load->library('form_validation');
        $this->form_validation->set_rules('to_coupon', '', 'required');
        
        if($this->form_validation->run() === TRUE)
        {
            $run = $this->Msetting->updateLimitUserCC();//, $arr_ing[3]);
            if($run == 200)
            {
                die('<meta charset="utf-8"><script>alert("cập nhật thành công");window.location.href="'.$this->data['baseurl'].'manage/setting";</script>');
            }
        }
        $this->data['action'] = 'settinglimit';
        $this->load->view('template/layout', $this->data);
    }
}
